/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.klikmee.sms.core.base.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceException;

import org.springframework.orm.jpa.JpaCallback;

import com.klikmee.sms.core.model.Provider;

/**
 * 
 * @author makcro
 */
public class ProviderDAO extends AbstractDAO<Provider> implements ProviderFacadeLocal {

	public ProviderDAO() {
		super( Provider.class );
	}

	public List<Provider> findRange( int[] range ) {
		throw new UnsupportedOperationException( "Not supported yet." );
	}

	public int count() {
		throw new UnsupportedOperationException( "Not supported yet." );
	}

	public Provider findByName( final String providerName ) {
		try {
			return (Provider) this.entityManager.createNamedQuery( "Provider.findByName" ).setParameter( "name", providerName ).getSingleResult();
		} catch (NoResultException e) {
			return null;
		}
	}
}
